package com.example.waterorder.config;


import com.example.waterorder.interceptor.AuthenticationFilter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

//@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource//必须有这个注解
    private AuthenticationFilter authenticationFilter;

    //    注入拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authenticationFilter)
                .excludePathPatterns("**/login")
                .excludePathPatterns("**/register")
                .excludePathPatterns("**/swagger-ui");
    }
}

